<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/ajax.js"></script>
    <script>
        function addCart(name){
            var s = "";
            if(a.checked){
                s += ("likes=" + a.value);
            }
            if(b.checked){
                s += ("&likes=" + b.value);
            }
            if(c.checked){
                s += ("&likes=" + c.value);
            }
            if(d.checked){
                s += ("&likes=" + d.value);
            }
            if(e.checked){
                s += ("&likes=" + e.value);
            }
            if(f.checked){
                s += ("&likes=" + f.value);
            }
            //?likes=xx&like=xxx
            get("Getindex1Servlet?"+s,
                function(res){
                    alert(res.msg);
                });
        }
    </script>
</head>
<body>
<form action="../Getindex1Servlet">
    你的爱好: <input type="checkbox" name="likes" value="电影" id="a">电影
    <input type="checkbox" name="likes" value="篮球" id="b">篮球
    <input type="checkbox" name="likes" value="手游" id="c">手游
    <input type="checkbox" name="likes" value="休闲" id="d">休闲
    <input type="checkbox" name="likes" value="旅行" id="e">旅行
    <input type="checkbox" name="likes" value="阅读" id="f">阅读
    <button type="button" onclick="addCart()">提交</button>
    <br>
   <a href="index2.html">下一页</a>
</form>
</body>
</html>